package com.zr.d_c.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.d_c.service.FuncService;
import com.zr.d_c.serviceimpl.FuncServiceImpl;

import net.sf.json.JSONArray;

/**
 * 获得所有一级功能
 * @author lsl
 */
public class ShowFirstFuncController extends HttpServlet {

	FuncService funcservice = new FuncServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter pw = resp.getWriter();
		JSONArray json = JSONArray.fromObject(funcservice.getFirstFunc());
		pw.write(json.toString());
		pw.close();
	}
}
